home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7914 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  50 lines

  1. Path: wmin.ac.uk!usenet
  2. From: Idoia Lertxundi <gsoec@wmin.ac.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Text file for linked list (structures)
  5. Date: 29 Feb 1996 16:57:12 GMT
  6. Organization: Westminster University
  7. Message-ID: <4h4lt8$7eu@badger.wmin.ac.uk>
  8. References: <4h0j5t$7h9@newshost.vvm.com>
  9. NNTP-Posting-Host: ux1.wmin.ac.uk
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (X11; I; SunOS 4.1.3_U1 sun4c)
  14. X-URL: news:4h0j5t$7h9@newshost.vvm.com
  15.  
  16. I have nested structures with pointers between them such as the one below.
  17.  
  18. My question can someone recommend me the best way to open a text(data) file to
  19. feed to the following structures. All courses first, frames and how the 
  20. prerequisites (prereq) bit?
  21.  
  22. Shall I use fgets to read a line at the time or shall I read character by 
  23. character fgetc?
  24.  
  25. I would appreciate any help. Thank you all.
  26.  
  27. typedef struct module
  28. {
  29.   char code[8];
  30. char name[25];
  31. char result[10];
  32. struct module *nextm;
  33. struct module *prereq;
  34. struct module *coreq;
  35. }MODULE;
  36.  
  37. typedef struct frame
  38.   char semester[4];
  39.   char level[3];
  40.   int freeelective;
  41.   struct module *cormods;
  42.   struct module *optmods;
  43.   struct frame *nextf;
  44. }FRAME;
  45.  
  46. <A HREF="mailto:gsoec@wmin.ac.uk">gsoec@wmin.ac.uk</A>
  47. <A HREF="http://www.wmin.ac.uk/~gsoec/">home page</A>
  48.  
  49.